define(['swiper'], ()=>{
    // function lbt(){
        var swiper = new Swiper(".mySwiper", {
            slidesPerView: 1,
            spaceBetween: 30,
            keyboard: {
              enabled: true,
            },
            pagination: {
              el: ".swiper-pagination",
              clickable: true,
            },
            navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev",
            },
            loop: true,
            autoplay: {
            delay: 2000,//1秒切换一次
            // pauseOnMouseEnter: true,
            disableOnInteraction: false,
            pauseOnMouseEnter: true,
      },
          });
    // }
    return{
        // lbt: lbt()
        lbt: swiper
    }
})

define(['jquery'],()=>{

  function xr(){
    $.get('./data/goods.json', 'json')
    .then(res=>{
        let data = res.slice(0, 30)
        render(data)
    })
    function render(data){
        data.forEach(item=>{
            $('.shopp')[0].innerHTML +=`
            <div class="shopping" >
                <div>
                    <a href="html/details.html?id=${item.goods_id}">
                    <img src="${item.img_small_logo}" alt=""></a></div>
               <p class="reds">￥${item.current_price}<span>￥${item.price}</span></p>
               <p class="hide"><a href="#">${item.title}</a><span></span></p>
               </div>
            `
        })
    }
  }
 
  return{
    xr:xr()
  }
})

